/**
 * Alibaba.com.cn Inc.
 * Copyright (c) 2004-2021 All Rights Reserved.
 */
package com.starlink.common.enums;

import java.util.Arrays;

/**
 * @author zhanghong
 * @version OrderTypeEnum.java, v 0.1 2024/4/11 22:26 下午 OrderTypeEnum Exp $$
 */
public enum OrderTypeEnum {
    BOOK(1, "书籍"),
    RIM(2, "周边"),
    INTEGRAL(3, "积分"),
    CART(4, "购物车"),
    SCHOOLBAG(5, "书包"),
    STAR(6, "星订单（星健康，星抚育，星文旅）"),
    DEPOSIT(7, "押金充值"),
    OPEN_VIP(8, "开通VIP");

    private Integer type;
    private String desc;

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    OrderTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static OrderTypeEnum getByType(Integer type) {
        if (type == null) {
            return null;
        }
        return Arrays.stream(values()).filter(item -> type.equals(item.getType())).findFirst().orElse(null);
    }
}
